package com.etc.service.impl;

import com.etc.dao.ShopCarMapper;
import com.etc.entity.ShopCar;
import com.etc.entity.ShopCarKey;
import com.etc.service.IShopCapService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author kalista
 * @Description
 * @Date 2021/1/4  16:59
 **/
@Service
public class ShopCapServiceImpl implements IShopCapService {
    private ShopCarMapper shopCarMapper;
    @Override
    public List<ShopCar> findAll() {
        try {
        List<ShopCar> shopCars = shopCarMapper.selectByExample(null);
        return shopCars;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Integer add(ShopCar shopCap) {
        try {
          return shopCarMapper.insert(shopCap);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public Integer deleteById(Integer id) {
        try {
            ShopCarKey shopCarKey = new ShopCarKey();
            shopCarKey.setId(id);
           return shopCarMapper.deleteByPrimaryKey(shopCarKey);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
